//
//  JWStarView.m
//  JWMovie
//
//  Created by Jorn.Wu on 15/7/25.
//  Copyright (c) 2015年 Jorn.Wu. All rights reserved.
//

#import "JWStarView.h"
#import "Star.h"

@interface JWStarView ()

@property (nonatomic, strong) Star *star;

@end

@implementation JWStarView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        _star = [[Star alloc] initWithFrame:CGRectZero];
        _star.max_star = 10;
        _star.show_star = 0;
        _star.font_size = 25;
        _star.empty_color = [UIColor grayColor];
        _star.full_color = [UIColor colorWithRed:255 / 255.f green:185 / 255.f blue:15 / 255.f alpha:1];
        [self addSubview:_star];
    }
    return self;
}

- (void)setRate:(CGFloat)rate{
    _rate = rate;
    self.star.show_star = _rate;
    [self setNeedsLayout];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.star.frame = self.bounds;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
